import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

export const columns : BasicColumn[] = [
	{
		title: '分类名称',
		dataIndex: 'gtitle',
		width: 350,
		align: 'left',
		customRender: ({ text, record }) => {
			if (!text) {
				return record.title
			}
		}
	},
/* 	{
		title: '显示样式',
		dataIndex: 'gtype',
	},
	{
		title: '说明文字',
		dataIndex: 'msg',
	}, */
	{
		title: '排序',
		dataIndex: 'sort',

	},
	{
		title: 'id',
		dataIndex: 'id',
	},

];

export const searchFormSchema : FormSchema[] = [
	/* 	{
			label: '名称',
			field: 'name',
			component: 'Input',
			colProps: { span: 6 },
		},
		{
			label: '编码',
			field: 'code',
			component: 'Input',
			colProps: { span: 6 },
		}, */
];

export const formSchema : FormSchema[] = [
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false,
	},
/* 	{
		label: '显示样式',
		field: 'gtype',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "index_page_style"
		},
		show: ({ values }) => {
			return values.pid == '0' || !values.pid;
		},
	}, */
	{
		label: '',
		field: 'pid',
		component: 'Input',
		show: false,
	},
	{
		label: '',
		field: 'code',
		component: 'Input',
		show: false,
	},
	
	{
		label: '分类名称',
		field: 'gtitle',
		required: true,
		component: 'Input',
	},
	
	{
		label: '排序',
		field: 'sort',
		required: true,
		component: 'Input',
	},
/* 	{
		label: '说明文字',
		field: 'msg',
		component: 'Input',
		show: ({ values }) => {
			return values.pid==0
	
		}
	}, */
];
export const formLeaderSchema : FormSchema[] = [
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false,
	},
	{
		label: '父级节点',
		field: 'pid',
		component: 'TreeSelect',
		componentProps: {
			//update-begin---author:wangshuai ---date:20230829  for：replaceFields已过期，使用fieldNames代替------------
			fieldNames: {
				//update-end---author:wangshuai ---date:20230829  for：replaceFields已过期，使用fieldNames代替------------
				value: 'key',
			},
			dropdownStyle: {
				maxHeight: '50vh',
			},
			getPopupContainer: () => document.body,
		},
		show: ({ values }) => {
			return values.pid !== '0';
		},
		dynamicDisabled: ({ values }) => {
			return !!values.id;
		},
	},
	{
		label: '分类名称',
		field: 'name',
		required: true,
		component: 'Input',
	},
	{
		label: '数字等级',
		field: 'num',
		required: true,
		component: 'Input',
	},
];

export const formCitySchema : FormSchema[] = [
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false,
	},
	{
		label: '父级节点',
		field: 'pid',
		component: 'TreeSelect',
		componentProps: {
			//update-begin---author:wangshuai ---date:20230829  for：replaceFields已过期，使用fieldNames代替------------
			fieldNames: {
				//update-end---author:wangshuai ---date:20230829  for：replaceFields已过期，使用fieldNames代替------------
				value: 'key',
			},
			dropdownStyle: {
				maxHeight: '50vh',
			},
			getPopupContainer: () => document.body,
		},
		show: ({ values }) => {
			return values.pid !== '0';
		},
		dynamicDisabled: ({ values }) => {
			return !!values.id;
		},
	},
	/* 	{
			label: '分类名称',
			field: 'name',
			required: true,
			component: 'Input',
		}, */
	{
		label: '选择城市',
		field: 'cityId',
		component: 'JTreeDict',
		componentProps: { async: true, parentCode: 'A02' },
	},
];